package apibasej.db.transaction.paginator;

import apibasej.db.to.PaginationTransformer;


public class PaginatorPostgre implements PaginationTransformer {

	@Override
	public String transformSelectForPagination(Integer firstResult, Integer maxResults, String sqlSelect) {
		StringBuilder resp = new StringBuilder(sqlSelect);
		if(maxResults!=null){
			resp.append(" LIMIT ");
			resp.append(maxResults);
		}
		if(firstResult!=null){
			resp.append(" OFFSET ");
			resp.append(firstResult);
		}
		return resp.toString();
	}

}
